﻿using System;
using CompactMapper.Orm.Contracts;
using CompactMapper.Orm.UnitOfWork.Mappings;

namespace CompactMapper.Orm.Annotations
{
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
    public abstract class PrimaryKeyAttribute : ColumnAttribute
    {
        public abstract string SqlType { get; }
        public abstract Type KeyType { get; }
    }

    public class LongPrimaryKeyAttribute : PrimaryKeyAttribute
    {
        private const String SqlInt = "long";

        public override string SqlType
        {
            get { return SqlInt; }
        }
        public override Type KeyType
        {
            get { return typeof(long); }
        }
    }

    public class GuidPrimaryKeyAttribute : PrimaryKeyAttribute
    {
        private const String SqlGuid = "guid";

        public override string SqlType
        {
            get { return SqlGuid; }
        }

        public override Type KeyType
        {
            get { return typeof(Guid); }
        }
    }

}